<?php
/**
	Sponsor Manager (categories.php file)
    Copyright (C) <Thu Apr 10 10:47:44 CEST 2008>  Marcos Ramírez <marcosramirez@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    
    Purpose:
    Last Modified:
**/

global $cat;
global $html;
$html->addCSSFile('categories.css');
$html->addJSFile('categories.js');

if ($_POST['categoryname']) {
	global $cat;
	global $html;
	$error=$cat->add($_POST['categoryname'], $_POST['father']);
	if ($error=='0') 
		$html->addInfo(_('Category addedd Correctly'));
	else 
		$html->addError($error);
}


$html->header();
?>

<p><a href="#" id="clickAddCategory"><?=_('Add Category')?></a></p>
<div id="addCategory">
<form method="post" action="<?=$Cfg['Sys']['webDir']?>?section=categories">
			<?=_('Add category:')?> <input name="categoryname" type="text" /> Under
			<select name="father">
			<?=$cat->getListOption()?>
			</select>
			<input type="submit" value="<?=_('Add Category')?>" />
</form>
</div>

<?php
echo '
<ul>
<li>
	Entertainment
	<ul>Games
		<ul>
		<li>Action</li>
		</ul>
	</ul>
</li>
</ul>

';

echo $cat->get_category_tree();



$html->footer();

?>